package cn.yunyichina.provider.sb.vo;

import cn.yunyichina.provider.sb.entity.MedicalPatient;
import com.alibaba.dubbo.common.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;

/**
 * Created by 15-AK on 2017/7/12.
 */
@Getter
@Setter
public class MedicalPatientVo  {
    private Short medicalType;
    /*本次拉取his患者信息返回的总条数*/
    private Integer totalRows;
    /*总条数确定下当前条数是第几条，从1开始计数*/
    private Integer currentOffset;
    /*患者ID患者唯一标识 对应patId*/
    private String patientId;
    /*患者类型 1-成人、2-儿童*/
    private Short patientType;
    /*患者姓名*/
    private String patientName;
    /*医院ID*/
    private String hospitalId;
    /*医院名称*/
    private String hospitalName;
    /*就诊时间*/
    private String visitDate;
    /*医疗类别*/
    private Short medicalCategory;
    /*国家*/
    private String country;
    /*民族*/
    private String nation;
    /*籍贯*/
    private String origoPlace;
    /*婚姻状况 1-未婚、2-已婚、3-丧偶、4-离婚、9-未说明*/
    private Short maritalStatus;
    /*医疗保险类别 01-社会基本医疗保险 ，02-商业医疗保险，03-大病统筹，04-新型农村合作医疗，05-城镇居民基本医疗保险，06-公费医疗，99-其他*/
    private String insType;
    /*证件类型 1-身份证、2-护照*/
    private Short certType;
    /*证件号码*/
    private String certNo;
    /*电子邮件地址*/
    private String email;
    /*本人号码*/
    private String selfTelephone;
    /*配偶号码*/
    private String partnerTelephone;
    /*家庭电话号码*/
    private String familyTelephone;
    /*家庭地址*/
    private String familyAddress;
    /*邮政编码*/
    private String familyPostCode;
    /*户籍地址*/
    private String censueAddress;
    /*工作单位名称*/
    private String workcompany;
    /*工作单位电话*/
    private String workTelephone;
    /*联系人姓名*/
    private String contactName;
    /*联系人电话*/
    private String contactTelephone;
    /*联系人地址*/
    private String contactAddress;
    /*联系人关系*/
    private String contactRelationship;
    /*监护人电话*/
    private String guardianTelephone;
    /*监护人姓名*/
    private String guardianName;
    /*监护人证件类型*/
    private Short guardionCertType;
    /*监护人证件号码*/
    private String guardionCertNo;
    /*门诊流水号/住院号*/
    private String serialNo;

    public MedicalPatientVo buildMedicalPatientVo(MedicalPatient medicalPatient){
        this.setPatientId(medicalPatient.getPatId());
        this.setPatientType(medicalPatient.getPatType());
        this.setPatientName(medicalPatient.getPatName());
        this.setHospitalId(medicalPatient.getHospitalId());
        this.setHospitalName(medicalPatient.getHospitalName());
        this.setVisitDate(medicalPatient.getVisitTime());
        this.setMedicalCategory(medicalPatient.getMedicalType());
        this.setCountry(medicalPatient.getCountry());
        this.setNation(medicalPatient.getNation());
        this.setOrigoPlace(medicalPatient.getHomeTownAddress());
        this.setMaritalStatus(medicalPatient.getMaritalStatus());
        this.setInsType(medicalPatient.getInsuranceType());
        this.setCertType(medicalPatient.getPatIdType());
        this.setCertNo(medicalPatient.getPatIdNo());
        this.setMedicalType(medicalPatient.getBusinessType());
        if (medicalPatient.getBusinessType()==1){
            this.setSerialNo(medicalPatient.getMzFeeId());
        }else if(medicalPatient.getBusinessType()==2){
            if (StringUtils.isNotEmpty(medicalPatient.getInpatientId())){
                this.setSerialNo(medicalPatient.getInpatientId());
            }else {
                this.setSerialNo(medicalPatient.getAdmissionNo()+"_"+medicalPatient.getInTime());
            }
        }

        this.setTotalRows(medicalPatient.getTotalRows());
        this.setCurrentOffset(medicalPatient.getCurrentOffset());

        this.setCensueAddress(medicalPatient.getHomeTownAddress());
        this.setContactAddress(medicalPatient.getContactAddress());
        this.setContactName(medicalPatient.getContactName());
        this.setContactRelationship(medicalPatient.getContactRelationShip());
        this.setContactTelephone(medicalPatient.getContactPhone());
        this.setEmail(medicalPatient.getEmail());
        this.setFamilyAddress(medicalPatient.getHomeAddress());
        this.setFamilyPostCode(medicalPatient.getPostCode());
        this.setFamilyTelephone(medicalPatient.getHomepHone());
        this.setGuardianName(medicalPatient.getGuardName());
        this.setGuardianTelephone(medicalPatient.getGuardMobile());
        this.setGuardionCertNo(medicalPatient.getGuardIdNo());
        this.setGuardionCertType(medicalPatient.getGuardIdType());
        this.setPartnerTelephone(medicalPatient.getSpouseMobile());
        this.setSelfTelephone(medicalPatient.getPatMobile());
        this.setWorkcompany(medicalPatient.getWorkcompany());
        this.setWorkTelephone(medicalPatient.getWorkPhone());
        return this;
    }

}